import request from '@/utils/http'
import type { GoodsItemModel } from '@/api/goods'

export interface MyGoodsRateGetListSendModel {
  page: number
  size: number
  goodsId: number | null
}
export interface MyGoodsRateGetListItem {
  id: number
  userId: number
  orderId: string
  adminId: number
  goodsId: number
  description: string
  count: number
  createTime: number
  updateTime: number
  goods: GoodsItemModel
  reply: ReplyItemModel
  user: { userName: string; avatar: string }
  admin: { userName: string; avatar: string }
}
export interface MyGoodsRateGetListReturnModel {
  total: number
  pageNum: number
  page: number
  size: number
  list: MyGoodsRateGetListItem[]
}
/** 获取评论列表  */
export function myGoodsRateGetList(params: MyGoodsRateGetListSendModel) {
  return request<MyGoodsRateGetListReturnModel>({
    url: '/myGoodsRate/getList',
    method: 'get',
    params,
  })
}

interface MyGoodsRateReplyCommentsSendModel {
  parentId: number
  type: string
  adminId: number
  userId: number
  goodsId: number
  description: string
}
/** 回复用户评论  */
export function myGoodsRateReplyComments(data: MyGoodsRateReplyCommentsSendModel) {
  return request({
    url: '/myGoodsRate/replyComments',
    method: 'post',
    data,
  })
}

// 回复信息数据item
interface ReplyItemModel {
  id: number
  parentId: number
  type: string
  adminId: number
  userId: number
  goodsId: number
  description: string
  createTime: number
  updateTime: number
}
